//
//  YJCityModel.m
//  YJB
//
//  Created by 韦朝宾 on 16/5/28.
//  Copyright © 2016年 YJB. All rights reserved.
//

#import "YJCityModel.h"

@implementation YJCityModel
- (instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init])
    {
        _city = dict[@"DivisionName"];
        _counties = [YJCountyModel countyWithArray:dict[@"DivisionSub"]];
    }
    return self;
}

+ (instancetype)cityWithDict:(NSDictionary *)dict
{
    return [[self alloc]initWithDict:dict];
}

+ (NSMutableArray *)citiesWithArray:(NSArray *)array
{
    NSMutableArray *cities = [NSMutableArray array];
    for (NSDictionary *dict in array)
    {
        YJCityModel *cityModel = [self cityWithDict:dict];
        [cities addObject:cityModel];
    }
    return cities;
}

@end
